package com.aj.activity.adapter;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.RelativeLayout;

public class InfoPagerAdapter extends PagerAdapter{
	private List<View> views;
	
	public InfoPagerAdapter(List<View> views) {
		this.views = views;
	}
		@Override
		public boolean isViewFromObject(View arg0, Object arg1) {
			return arg0 == arg1;
		}
		
		@Override
		public int getCount() {
			return views.size();
		}

		@Override
		public void destroyItem(View container, int position, Object object) {
			((ViewPager)container).removeView(views.get(position));
		}

		@Override
		public Object instantiateItem(View container, int position) {
	        // TODO Auto-generated method stub
	        ((ViewPager)container).addView(views.get(position));
	        //给每个item的view 就是刚才views存放着的view
	        return views.get(position);
		}
	};